package com.crm.system.controller.sys;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.model.entity.sys.VersionUpgrade;
import com.crm.model.qo.sys.VersionUpgradeQO;
import com.crm.system.service.sys.VersionUpgradeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author luojie
 * @date 2021/6/10 9:34
 */
@RestController
@RequestMapping("/versionUpgrade")
@Slf4j
public class VersionUpgradeController {

    @Autowired
    private VersionUpgradeService versionUpgradeService;

    /***
     * @Description:查询版本号
     * @Param:
     * @Author: luojie
     * @Date: 2021/6/10 13:53
     */
    @GetMapping("/getVersionInfo")
    public DataResponse getVersionUpgrade(){
        VersionUpgrade versionUpgrade = versionUpgradeService.getVersionUpgrade();
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),versionUpgrade);
    }

    /**
     * 添加版本信息
     * @param versionUpgradeQO 版本添加对象
     * @return
     */
    @PostMapping("/addVersionInfo")
    public DataResponse addVersionInfo(@RequestBody VersionUpgradeQO versionUpgradeQO){
        Boolean result = versionUpgradeService.addVersionInfo(versionUpgradeQO);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode());
    }
}
